<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.9.1"/>
<title>knet: E:/knet-git/knet/knet/thread_api.h 源文件</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td style="padding-left: 0.5em;">
   <div id="projectname">knet
   &#160;<span id="projectnumber">1.4.3</span>
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.9.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>首页</span></a></li>
      <li><a href="modules.html"><span>模块</span></a></li>
      <li><a href="annotated.html"><span>类</span></a></li>
      <li class="current"><a href="files.html"><span>文件</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="搜索" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>文件列表</span></a></li>
    </ul>
  </div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_885cc87fac2d91e269af0a5a959fa5f6.html">E:</a></li><li class="navelem"><a class="el" href="dir_4e74998c9a9305a116abc25fcf9a1edb.html">knet-git</a></li><li class="navelem"><a class="el" href="dir_a1c045b39f32066568ae964b52db514f.html">knet</a></li><li class="navelem"><a class="el" href="dir_f76d03789f0b12416cfffea59e2ed47d.html">knet</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">thread_api.h</div>  </div>
</div><!--header-->
<div class="contents">
<div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">/*</span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160;<span class="comment"> * Copyright (c) 2014-2015, dennis wang</span></div>
<div class="line"><a name="l00003"></a><span class="lineno">    3</span>&#160;<span class="comment"> * All rights reserved.</span></div>
<div class="line"><a name="l00004"></a><span class="lineno">    4</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00005"></a><span class="lineno">    5</span>&#160;<span class="comment"> * Redistribution and use in source and binary forms, with or without</span></div>
<div class="line"><a name="l00006"></a><span class="lineno">    6</span>&#160;<span class="comment"> * modification, are permitted provided that the following conditions are met:</span></div>
<div class="line"><a name="l00007"></a><span class="lineno">    7</span>&#160;<span class="comment"> *     * Redistributions of source code must retain the above copyright</span></div>
<div class="line"><a name="l00008"></a><span class="lineno">    8</span>&#160;<span class="comment"> *       notice, this list of conditions and the following disclaimer.</span></div>
<div class="line"><a name="l00009"></a><span class="lineno">    9</span>&#160;<span class="comment"> *     * Redistributions in binary form must reproduce the above copyright</span></div>
<div class="line"><a name="l00010"></a><span class="lineno">   10</span>&#160;<span class="comment"> *       notice, this list of conditions and the following disclaimer in the</span></div>
<div class="line"><a name="l00011"></a><span class="lineno">   11</span>&#160;<span class="comment"> *       documentation and/or other materials provided with the distribution.</span></div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="comment"> * </span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="comment"> * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot; AND</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="comment"> * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="comment"> * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160;<span class="comment"> * DISCLAIMED. IN NO EVENT SHALL dennis wang BE LIABLE FOR ANY</span></div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="comment"> * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160;<span class="comment"> * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;</span></div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="comment"> * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="comment"> * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="comment"> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="comment"> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="comment"> */</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor">#ifndef THREAD_API_H</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor">#define THREAD_API_H</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;</div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160;<span class="preprocessor">#include &quot;config.h&quot;</span></div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160;</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;<span class="keyword">extern</span> <a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* <a class="code" href="group__thread.html#gac20d7726e152e0b49209ce228893c25d">thread_runner_create</a>(thread_func_t func, <span class="keywordtype">void</span>* params);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="group__thread.html#ga8b9d3d45b6055971fc40f24ec6572cf6">thread_runner_destroy</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner);</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160;</div>
<div class="line"><a name="l00069"></a><span class="lineno">   69</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="group__thread.html#ga1114fd962e310f9d31ed4e83d8a21897">thread_runner_start</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner, <span class="keywordtype">int</span> stack_size);</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;</div>
<div class="line"><a name="l00075"></a><span class="lineno">   75</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="group__thread.html#gaa035f190ffd3d7f117b8fbb58716f042">thread_runner_stop</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner);</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;</div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="group__thread.html#ga93f88ba77e7eab786da6fe7d1f681a2e">thread_runner_start_loop</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner, <a class="code" href="struct__loop__t.html">loop_t</a>* loop, <span class="keywordtype">int</span> stack_size);</div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;</div>
<div class="line"><a name="l00095"></a><span class="lineno">   95</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="group__thread.html#ga9191991e2bd7f91fe68324c2855d581d">thread_runner_start_timer_loop</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner, <a class="code" href="struct__ktimer__loop__t.html">ktimer_loop_t</a>* timer_loop, <span class="keywordtype">int</span> stack_size);</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;</div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="group__thread.html#ga813a718c56e0923be9396630c8460794">thread_runner_join</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner);</div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;</div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="group__thread.html#ga95c00ec3d6ef1710cc8d8bb8cb7e585d">thread_runner_check_start</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner);</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span>* <a class="code" href="group__thread.html#gaf67fa2b2cfefc2de422a31b9dfad2bca">thread_runner_get_params</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner);</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;<span class="keyword">extern</span> thread_id_t <a class="code" href="group__thread.html#gaecf10907eee00ec0e807271c906a6645">thread_get_self_id</a>();</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;</div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">void</span> <a class="code" href="group__thread.html#gabddf3ac30aac3f22f8c53b7517e6eb35">thread_sleep_ms</a>(<span class="keywordtype">int</span> ms);</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;</div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;<span class="keywordtype">int</span> <a class="code" href="group__thread.html#gaa187b2cd2c906680890fb4ea2833d665">thread_set_tls_data</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner, <span class="keywordtype">void</span>* data);</div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;</div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;<span class="keywordtype">void</span>* <a class="code" href="group__thread.html#ga63c9be5b8fb04c0b26382f51b7bdf237">thread_get_tls_data</a>(<a class="code" href="struct__thread__runner__t.html">thread_runner_t</a>* runner);</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;</div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;<span class="keyword">extern</span> atomic_counter_t <a class="code" href="group__thread.html#gade4f41f1cd519f2719b5114ce7801232">atomic_counter_inc</a>(atomic_counter_t* counter);</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;</div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160;<span class="keyword">extern</span> atomic_counter_t <a class="code" href="group__thread.html#gafc2df03d75cf9168b72e8c5e11953437">atomic_counter_dec</a>(atomic_counter_t* counter);</div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;<span class="keyword">extern</span> <span class="keywordtype">int</span> <a class="code" href="group__thread.html#ga141897cac9743394a99ff7780daa6a80">atomic_counter_zero</a>(atomic_counter_t* counter);</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160;</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* THREAD_API_H */</span><span class="preprocessor"></span></div>
<div class="ttc" id="group__thread_html_gabddf3ac30aac3f22f8c53b7517e6eb35"><div class="ttname"><a href="group__thread.html#gabddf3ac30aac3f22f8c53b7517e6eb35">thread_sleep_ms</a></div><div class="ttdeci">void thread_sleep_ms(int ms)</div><div class="ttdef"><b>Definition:</b> misc.c:775</div></div>
<div class="ttc" id="struct__ktimer__loop__t_html"><div class="ttname"><a href="struct__ktimer__loop__t.html">_ktimer_loop_t</a></div><div class="ttdef"><b>Definition:</b> timer.c:44</div></div>
<div class="ttc" id="group__thread_html_gac20d7726e152e0b49209ce228893c25d"><div class="ttname"><a href="group__thread.html#gac20d7726e152e0b49209ce228893c25d">thread_runner_create</a></div><div class="ttdeci">thread_runner_t * thread_runner_create(thread_func_t func, void *params)</div><div class="ttdef"><b>Definition:</b> misc.c:539</div></div>
<div class="ttc" id="group__thread_html_gaa187b2cd2c906680890fb4ea2833d665"><div class="ttname"><a href="group__thread.html#gaa187b2cd2c906680890fb4ea2833d665">thread_set_tls_data</a></div><div class="ttdeci">int thread_set_tls_data(thread_runner_t *runner, void *data)</div><div class="ttdef"><b>Definition:</b> misc.c:783</div></div>
<div class="ttc" id="group__thread_html_ga9191991e2bd7f91fe68324c2855d581d"><div class="ttname"><a href="group__thread.html#ga9191991e2bd7f91fe68324c2855d581d">thread_runner_start_timer_loop</a></div><div class="ttdeci">int thread_runner_start_timer_loop(thread_runner_t *runner, ktimer_loop_t *timer_loop, int stack_size)</div><div class="ttdef"><b>Definition:</b> misc.c:696</div></div>
<div class="ttc" id="struct__thread__runner__t_html"><div class="ttname"><a href="struct__thread__runner__t.html">_thread_runner_t</a></div><div class="ttdef"><b>Definition:</b> misc.c:36</div></div>
<div class="ttc" id="group__thread_html_gaecf10907eee00ec0e807271c906a6645"><div class="ttname"><a href="group__thread.html#gaecf10907eee00ec0e807271c906a6645">thread_get_self_id</a></div><div class="ttdeci">thread_id_t thread_get_self_id()</div><div class="ttdef"><b>Definition:</b> misc.c:767</div></div>
<div class="ttc" id="group__thread_html_ga93f88ba77e7eab786da6fe7d1f681a2e"><div class="ttname"><a href="group__thread.html#ga93f88ba77e7eab786da6fe7d1f681a2e">thread_runner_start_loop</a></div><div class="ttdeci">int thread_runner_start_loop(thread_runner_t *runner, loop_t *loop, int stack_size)</div><div class="ttdef"><b>Definition:</b> misc.c:662</div></div>
<div class="ttc" id="group__thread_html_ga1114fd962e310f9d31ed4e83d8a21897"><div class="ttname"><a href="group__thread.html#ga1114fd962e310f9d31ed4e83d8a21897">thread_runner_start</a></div><div class="ttdeci">int thread_runner_start(thread_runner_t *runner, int stack_size)</div><div class="ttdef"><b>Definition:</b> misc.c:627</div></div>
<div class="ttc" id="group__thread_html_ga95c00ec3d6ef1710cc8d8bb8cb7e585d"><div class="ttname"><a href="group__thread.html#ga95c00ec3d6ef1710cc8d8bb8cb7e585d">thread_runner_check_start</a></div><div class="ttdeci">int thread_runner_check_start(thread_runner_t *runner)</div><div class="ttdef"><b>Definition:</b> misc.c:757</div></div>
<div class="ttc" id="group__thread_html_gaa035f190ffd3d7f117b8fbb58716f042"><div class="ttname"><a href="group__thread.html#gaa035f190ffd3d7f117b8fbb58716f042">thread_runner_stop</a></div><div class="ttdeci">void thread_runner_stop(thread_runner_t *runner)</div><div class="ttdef"><b>Definition:</b> misc.c:730</div></div>
<div class="ttc" id="struct__loop__t_html"><div class="ttname"><a href="struct__loop__t.html">_loop_t</a></div><div class="ttdef"><b>Definition:</b> loop.c:35</div></div>
<div class="ttc" id="group__thread_html_ga8b9d3d45b6055971fc40f24ec6572cf6"><div class="ttname"><a href="group__thread.html#ga8b9d3d45b6055971fc40f24ec6572cf6">thread_runner_destroy</a></div><div class="ttdeci">void thread_runner_destroy(thread_runner_t *runner)</div><div class="ttdef"><b>Definition:</b> misc.c:548</div></div>
<div class="ttc" id="group__thread_html_ga141897cac9743394a99ff7780daa6a80"><div class="ttname"><a href="group__thread.html#ga141897cac9743394a99ff7780daa6a80">atomic_counter_zero</a></div><div class="ttdeci">int atomic_counter_zero(atomic_counter_t *counter)</div><div class="ttdef"><b>Definition:</b> misc.c:475</div></div>
<div class="ttc" id="group__thread_html_gade4f41f1cd519f2719b5114ce7801232"><div class="ttname"><a href="group__thread.html#gade4f41f1cd519f2719b5114ce7801232">atomic_counter_inc</a></div><div class="ttdeci">atomic_counter_t atomic_counter_inc(atomic_counter_t *counter)</div><div class="ttdef"><b>Definition:</b> misc.c:459</div></div>
<div class="ttc" id="group__thread_html_ga813a718c56e0923be9396630c8460794"><div class="ttname"><a href="group__thread.html#ga813a718c56e0923be9396630c8460794">thread_runner_join</a></div><div class="ttdeci">void thread_runner_join(thread_runner_t *runner)</div><div class="ttdef"><b>Definition:</b> misc.c:735</div></div>
<div class="ttc" id="group__thread_html_ga63c9be5b8fb04c0b26382f51b7bdf237"><div class="ttname"><a href="group__thread.html#ga63c9be5b8fb04c0b26382f51b7bdf237">thread_get_tls_data</a></div><div class="ttdeci">void * thread_get_tls_data(thread_runner_t *runner)</div><div class="ttdef"><b>Definition:</b> misc.c:813</div></div>
<div class="ttc" id="group__thread_html_gaf67fa2b2cfefc2de422a31b9dfad2bca"><div class="ttname"><a href="group__thread.html#gaf67fa2b2cfefc2de422a31b9dfad2bca">thread_runner_get_params</a></div><div class="ttdeci">void * thread_runner_get_params(thread_runner_t *runner)</div><div class="ttdef"><b>Definition:</b> misc.c:762</div></div>
<div class="ttc" id="group__thread_html_gafc2df03d75cf9168b72e8c5e11953437"><div class="ttname"><a href="group__thread.html#gafc2df03d75cf9168b72e8c5e11953437">atomic_counter_dec</a></div><div class="ttdeci">atomic_counter_t atomic_counter_dec(atomic_counter_t *counter)</div><div class="ttdef"><b>Definition:</b> misc.c:467</div></div>
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
生成于 2015年 七月 9日 星期四 14:59:53 , 为 knet使用  &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.9.1
</small></address>
</body>
</html>
